package com.itheima;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

public class Producer_Queue {
    public static void main(String[] args) throws IOException, TimeoutException {
        ConnectionFactory factory = new ConnectionFactory();
        Connection connection = factory.newConnection();
        Channel channel = connection.createChannel();
        channel.queueDeclare("work-queue",true,false,false,null);
        for (int i = 0; i < 10; i++) {
            channel.basicPublish("","work-queue",null,(i+"hello-rabbitmq").getBytes());
        }
        channel.close();
        connection.close();
    }
}
